home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 4 / BBS in a Box - Macintosh - Volume IV (January 1992) (BBS in a Box).iso / Files / Prog / A / Alpha.4.01.cpt / Alpha.4.01.rsrc / STR#_129.txt < prev    next >
Encoding:
Text File  |  1991-10-22  |  5.3 KB  |  407 lines

  1. Customizing ALPHA
  2.  
  3. Alpha can be customized through key bindings, variable
  4.  
  5. definitions, and macros. All three customizations are
  6.  
  7. written in language that Alpha can recognize, and stored
  8.  
  9. in ordinary text files. The customizations can be loaded
  10.  
  11. in three ways:
  12.  
  13. 
  14.  
  15.   1) The 'AlphaBits' file is always loaded at startup.
  16.  
  17.   2) The "Load Window" item of the Customize menu loads
  18.  
  19.      an entire window at once.
  20.  
  21.   3) If a selection is hilited, the above item
  22.  
  23.      changes to "Load Selection", and only
  24.  
  25.      the hilited text get loaded.
  26.  
  27. 
  28.  
  29. The language that Alpha recognizes has several different
  30.  
  31. types of statements:
  32.  
  33. 
  34.  
  35. Key Bindings
  36.  
  37. 
  38.  
  39. Any function or loaded macro can be bound to any single
  40.  
  41. keystroke. One way to bind a function is with a
  42.  
  43. statement such as:
  44.  
  45. 
  46.  
  47.       (bind '<character>' [modifier string] funcName)
  48.  
  49. 
  50.  
  51. where c is a character, 'modifier string' is a string
  52.  
  53. containing one or more of:
  54.  
  55. 
  56.  
  57.       c   - command modifier
  58.  
  59.       o   - option modifier
  60.  
  61.       s   - shift modifier
  62.  
  63.       z   - control modifier
  64.  
  65.       e   - escape modifier
  66.  
  67.       x   - prefixChar modifier
  68.  
  69. 
  70.  
  71. The following line binds cmd-shift-f to the function
  72.  
  73. 'forwardChar':
  74.  
  75. 
  76.  
  77.       (bind 'f' <cs> forwardChar)
  78.  
  79. 
  80.  
  81. With the standard US keyboard, 'forwardChar' could also
  82.  
  83. be bound by using the keycode for the 'f' key:
  84.  
  85. 
  86.  
  87.       (bind '\03' <cs> forwardChar)
  88.  
  89. 
  90.  
  91. The key code for any given key can be obtained by using
  92.  
  93. the 'keyCode' function. While the first form is
  94.  
  95. machine-independent, the second form is
  96.  
  97. machine-dependent. In both forms, the modifier string is
  98.  
  99. optional. To use ALPHA with an original mac keyboard,
  100.  
  101. comment out the line:
  102.  
  103. 
  104.  
  105.       "#define MACII ....."
  106.  
  107. 
  108.  
  109. Note that menu item command equivalents take precedence
  110.  
  111. over bindings. Command equivalents can only be changed
  112.  
  113. by using an external tool like 'ResEdit'.
  114.  
  115. 
  116.  
  117. Unbindings
  118.  
  119. 
  120.  
  121. The following forms allow bindings to be removed:
  122.  
  123.      (ubind '<single character>' [modifier str])
  124.  
  125.      (ubind '\<2-digit hex key code>' [modifier str])
  126.  
  127.      (ubind <ascii code> [modifier str])
  128.  
  129. 
  130.  
  131. 
  132.  
  133. Assigning Values to Variables
  134.  
  135. 
  136.  
  137. There are many user-definable integer variables in
  138.  
  139. ALPHA.  Variables can be assigned as follows:
  140.  
  141. 
  142.  
  143.       (set sillyVar 1)
  144.  
  145. 
  146.  
  147. The values 'on' and 'off' map to '1' and '0',
  148.  
  149. respectively, so the above example could be written:
  150.  
  151. 
  152.  
  153.       (set sillyVar on)
  154.  
  155. 
  156.  
  157. There are also a few string variables, which are bound
  158.  
  159. in an analogous fashion:
  160.  
  161. 
  162.  
  163.       (set dumString "the string")
  164.  
  165. 
  166.  
  167. 
  168.  
  169. 
  170.  
  171. 
  172.  
  173. 
  174.  
  175. 
  176.  
  177. 
  178.  
  179. 
  180.  
  181. 
  182.  
  183. 
  184.  
  185. 
  186.  
  187. The 'Open Special' Menu
  188.  
  189. 
  190.  
  191. Files can be attached to a hierarchical menu hanging
  192.  
  193. from 'File:Open Special'. These files are specified by
  194.  
  195. complete pathname with the following syntax:
  196.  
  197. 
  198.  
  199.   (special
  200.  
  201.     "<pathname>"
  202.  
  203.         :  :    )
  204.  
  205. 
  206.  
  207. Command equivalents can be attached to items by
  208.  
  209. appending '/<char>' to the end ONLY of the complete
  210.  
  211. file-pathname,
  212.  
  213. 
  214.  
  215. 
  216.  
  217. User-defined Menus
  218.  
  219. 
  220.  
  221. Alpha allows the the user to build custom menus which
  222.  
  223. contain names of functions or macros that just HAVE to
  224.  
  225. be in the menus, as opposed to being merely callable
  226.  
  227. through the bindings. The syntax is dead simple. See the
  228.  
  229. 'AlphaBits' file for an example. The following meta
  230.  
  231. characters can be embedded in the strings:
  232.  
  233. 
  234.  
  235.    Meta-character     Usage
  236.  
  237.    --------------     -----
  238.  
  239. 
  240.  
  241.     ; or Return       Separates multiple items.
  242.  
  243.     ^                 Followed by an icon number, adds
  244.  
  245.                       that icon to the item.
  246.  
  247.     !                 Followed by a character, marks the
  248.  
  249.                       item with that character.
  250.  
  251.     <                 Followed by B, I, U, O, or S, sets
  252.  
  253.                       the character style of the item.
  254.  
  255.     /                 Followed by a character, sets up
  256.  
  257.                       a keyboard equivalent.
  258.  
  259.     (                 Disables the item.
  260.  
  261. 
  262.  
  263. Once the menus are created, they can be inserted and
  264.  
  265. deleted from the menu bar by the syntax:
  266.  
  267.    (insertMenu "name")
  268.  
  269.    (deleteMenu "name")
  270.  
  271. as well as through macros.
  272.  
  273. 
  274.  
  275. The following strings have the obvious special meanings
  276.  
  277. when used as menu item text:
  278.  
  279.   TILEMENU
  280.  
  281.   FLAGMENU
  282.  
  283.   VARMENU
  284.  
  285.   ACMDMENU
  286.  
  287.   MACROMENU
  288.  
  289.   FSETMENU
  290.  
  291.   WINDOWMENU
  292.  
  293. 
  294.  
  295. The 'WINDOWMENU' (the menu that allows selection of
  296.  
  297. windows) cannot be redefined after startup and can only
  298.  
  299. be used in one menu.
  300.  
  301. 
  302.  
  303. 
  304.  
  305. 
  306.  
  307. Suffix Hooks
  308.  
  309. 
  310.  
  311. Alpha allows you to specify that a macro be executed
  312.  
  313. whenever a file with the correct suffix is opened or
  314.  
  315. activated. The syntax is:
  316.  
  317. 
  318.  
  319.     (suffixHook ".<suffix>" <macroName>)
  320.  
  321. 
  322.  
  323. For example:
  324.  
  325. 
  326.  
  327.     (suffixHook ".c" setCMode)
  328.  
  329. 
  330.  
  331. executes the macro 'setCMode' whenever a window ending
  332.  
  333. in .c is loaded or activated. Suffixes can not be more
  334.  
  335. than five characters in length. The only way to remove
  336.  
  337. suffix hooks is to restart.
  338.  
  339. 
  340.  
  341. 
  342.  
  343. 
  344.  
  345. 
  346.  
  347. 
  348.  
  349. 
  350.  
  351. 
  352.  
  353. 
  354.  
  355. 
  356.  
  357. Miscellaneous Syntax Matter
  358.  
  359. 
  360.  
  361. Comments begin with ';' and continue to the end of the
  362.  
  363. current line.
  364.  
  365. 
  366.  
  367. The #define, #ifdef, #else, and #endif preprocessor
  368.  
  369. commands can be used in a loaded file as follows:
  370.  
  371. 
  372.  
  373. #ifdef TAG
  374.  
  375. <first set of definitions>
  376.  
  377. #else TAG
  378.  
  379. <second set of definitions>
  380.  
  381. #endif TAG
  382.  
  383. 
  384.  
  385. If 'TAG' is defined as follows:
  386.  
  387. 
  388.  
  389. #define TAG
  390.  
  391. 
  392.  
  393. the first set of definitions will be loaded. Otherwise
  394.  
  395. the second set will be loaded. The else clause is
  396.  
  397. optional.  Ifdefs can not be nested.
  398.  
  399. 
  400.  
  401. 
  402.  
  403. 
  404.  
  405. 
  406.  
  407.